/**=========================================================================================
 *				用于生成首页中的待办事宜、待办文件等内容
 *==========================================================================================
 *
 *	如果想使用任意的条件来取当前操作员的待办事宜表中的数据，
 *		可以使用./sysPendingsAction!getSysPendingsForUser.shtml，将条件赋值给sysPendings对象的相应属性。
 *		如果流程分类库为多个，可以通过wfLibIds参数来指定流程分类库的id。多个id之间，以“,”分隔
 *		如果需要取指定流程定义信息的流程实例数据，可以通过wfDefInfoIds参数来指定流程定义信息的id。多个id之间，以“,”分隔
 *	调用方式如下：
 *		$.getJSON("./sysPendingsAction!getSysPendingsForUser.shtml",
 *			{
 *				"sysPendings.type":"READ",			// 类型为“待阅”
 *				"sysPendings.setSenderId":11,		// 创建人id为11
 *				类似于以上的更多的条件
 *				"wfLibIds":"1,2,3",					// 所属流程分类库id指定为：1,2,3 这三个
 *				"wfDefInfoIds":"11,22,33"			// 所属流程定义信息的id为11,22,33这三个
 *			}
 *			function(data){}
 *		);
 *
 *
 *
 *	返回的数据，包括两个部分：数据总条数、以前前10条数据
 *		一般用以下方式生成：
 *
 *			// 输出json格式结果，包括：总的数据条数、前10条数据
 *			Map<String, Object> result = new HashMap<String, Object>();
 *			result.put("totalRows", page.getTotalCount());
 *			result.put("rowDatas", page.getList());
 *
 *			Struts2Utils.outJSON(result);
 *
 ============================================================================================*/

// 待办事宜
var url_deals = "./sysPendingsAction!getDealsForUser.shtml?r=" + Math.random();
// 待阅事宜
var url_reads = "./sysPendingsAction!getReadsForUser.shtml?r=" + Math.random();
// 自由条件取待办事宜
var url_sysPending = "./sysPendingsAction!getSysPendingsForUser.shtml?r=" + Math.random();

var url_sysPendingSzf = "./sysPendingsAction!getSysPendingsForUserWithWarn.shtml?r=" + Math.random();

var url_sysPendingPsAndXj = "./sysPendingsAction!getSysPendingsForUserPsAndXj.shtml?r=" + Math.random();

// 文件分类库id
var wbLibIdsForFile = "0,1,6,10,13,16,20,22,26";
// 会议分类库id
var wbLibIdsForMeeting = "2";
// 待办事宜分类库id（除了文件外的分类库id）		TODO:id没有设置正确
var wbLibIdsForDbsy = "5,18";

// 取几行数据			//leaderRowsNumber在homepage.ftl中申明，领导登录首页默认显示6条
var rowsNumber = leaderRowsNumber||10;
/**
 * 生成待办事宜、待办会议、待办文件、待阅文件列表的相关信息
 *
 * 数据结构：[事项名称,生成数据的url地址,加在url后的参数,存放数据条数及列表窗口的id前缀]
 * @type
 */
var toDoInfo = [
	["待办会议",url_sysPending,		{
			"sysPendings.type":		"READ",
			"sysPendings.isDeal":	0,
			"sysPendings.endTime":	"now",					// 到期时间。只有本参数不为空，系统即会自动取未到结束时间的数据
			"wfLibIds":				wbLibIdsForMeeting
		},"dbhy"],
	["待办文件",	url_sysPendingSzf,		{
			"sysPendings.type":		"DEAL",
			//"sysPendings.isDeal":	0,
			"wfLibIds":				wbLibIdsForFile
		},"dbwj"],
	["待阅文件",url_sysPending ,{
			"sysPendings.type":		"READ",
			"sysPendings.isRead":	0,
			"wfLibIds":				wbLibIdsForFile
		},"dywj"]
];



/**
 * 相关信息
 *
 * 数据结构：[分类名称,生成数据的url地址,点击数据执行的方法,点击"更多"打开的地址]
 * @type
 */
var usersInfo = [
//		["电子邮件","./mailMessageAction!listAllInboxMailForAjax.shtml?r="	+ Math.random(),
//				"mail",	"./mailMessageAction!listAllInboxMail.shtml"], 			// 电子邮件
		["电子邮件","./mailReceiverAction!listAllInboxMailForAjax.shtml?r="	+ Math.random(),
				"mail",	"./mailReceiverAction!message.shtml"], 			// 电子邮件
		["公共资料","./kldAction!getLastestAddedKld.shtml?r=" + Math.random(),
				"kld","./kldAction!list.shtml?kldGroup.id=2"], 				// 最新上传的公共资料
		["我的资料","./kldAction!getMyselfKld.shtml?r=" + Math.random(),
				"myselfKld","./kldAction!list.shtml?kldGroup.id=1"], 				// 最新上传我的资料
		["最近日程","./planSchedulerAction!listForIndex.shtml?r=" + Math.random(),
				"planScheduler", "./planSchedulerAction!view.shtml"]] 			// 最近日程

var planInfo = [
		["工作计划","./planWorkAction!indexWork.shtml?r=" + Math.random(),
				"gzjh","./planWorkAction!noCheckList.shtml"], 				// 待审核工作计划
		["工作总结","./planProgressAction!indexProgress.shtml?r=" + Math.random(),
				"gzzj", "./planProgressAction!noCheckList.shtml"]] 			// 待审核工作总结


$(document).ready(function(){
	// 生成待办事宜、待办会议、待办文件、待阅文件列表的相关信息
	for(var i=0;i < toDoInfo.length;i++){
		createToDoInfoData(toDoInfo,i);
	}
	loadXxsbPublication();
	loadLastestPishiList();
	loadDutyDiaryList();
	loadSfFile({
         "sysPendings.type": "DEAL",
         "sysPendings.isDeal": 0,
         "wfLibIds": wbLibIdsForFile
     });
	loadPsFile({"wfLibIds":wbLibIdsForDbsy	});
	loadKldByLeader({"kldGroup.id":3});
	
	loadWeekTodoData({
		"sysPendings.type":		"DEAL",
		"sysPendings.isDeal":	0,
		"sysPendings.tblName":	"WEEK_RECORD"
	});
	loadWeekCheckData({
		"sysPendings.type":		"DEAL",
		"sysPendings.isDeal":	0,
		"sysPendings.tblName":	"WEEK_REVIEW"
	});

	// 生成待办事宜 select a.id,a.create_time as send_time,a.title,a.sender_name,a.tbl_name,a.data_id,case when b.id is null then 0 else 1 end as isNeedReplyFlg,b.display_color,d.time_limit,b.back_plan_finishtime
	var url_dbsy= "./sysPendingsAction!getSysPendingsForUserPsAndXj.shtml?wfLibIds="+wbLibIdsForDbsy+"&r=" + Math.random();
	var str_index_dbsy =new Array();
	var ii_dbsy = 0;
	$.getJSON(url_dbsy,
		function(data){
			if(typeof(data.fail)!="undefined"){
				alert("取待办事宜时出错：" + data.fail);
			}else{
				$("#dbsy_rows").html(data.totalRows);
			}

			$(data.rowDatas).each(function(pend){

				ii_dbsy++;
				if(ii_dbsy<=rowsNumber){
					str_index_dbsy.push('<li>');
					str_index_dbsy.push('	<div class="title" title="'+this[2]+'">');

					// 判断是待处理还是下属局单位待办
					if(typeof(this[4])!="undefined" && this[4]=="WF_REPLY_OBJECT"){

						// 分期办
						if(typeof(this[8])!="undefined" && this[8]==5){

							str_index_dbsy.push('		<a href="#" onclick="openDetail(\'wfReplyObjectFqb\','+ this[0] +');return false;">');
							if(typeof(this[7])!="undefined" && this[7]=="yellow"){
								str_index_dbsy.push('	<img border=0 src="' + _skinPath + '/images/lightY16.gif">');
							}else if(typeof(this[7])!="undefined" && this[7]=="red"){
								str_index_dbsy.push('	<img border=0 src="' + _skinPath + '/images/lightR16.gif">');
							}

						}else{
							// 非分期办
							str_index_dbsy.push('		<a href="#" onclick="openDetail(\'wfReplyObject\','+ this[0] +');return false;">');
							if(typeof(this[7])!="undefined" && this[7]=="yellow"){
								str_index_dbsy.push('	<img border=0 src="' + _skinPath + '/images/lightY16.gif">');
							}else if(typeof(this[7])!="undefined" && this[7]=="red"){
								str_index_dbsy.push('	<img border=0 src="' + _skinPath + '/images/lightR16.gif">');
							}
						}

						if(typeof(this[9])!="undefined" && !isEmpty(this[9])){
							str_index_dbsy.push("[<span style=\"font-weight:bold;color:red;\">"+this[9]+"</span>]");
						}

					}else{
						str_index_dbsy.push('		<a href="#" onclick="openDetail(\'wfEntity\','+ this[0] +');return false;">');
					}



					str_index_dbsy.push(this[2]);
					str_index_dbsy.push('		</a>');
					if(this[1].substring(0,10)==$("#today").val()){
						str_index_dbsy.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
					}
					str_index_dbsy.push('	</div>');
					str_index_dbsy.push('	<div class="date"  title="' + this[1] + '">');
					// 判断是待处理还是下属局单位待办
					if(typeof(this[4])!="undefined" && this[4]=="WF_REPLY_OBJECT"){
						// 分期办
						if(typeof(this[8])!="undefined" && this[8]==5){
							str_index_dbsy.push('		<a href="#" onclick="openDetail(\'wfReplyObjectFqb\','+ this[0] +');return false;">');
						}else{
							// 非分期办
							str_index_dbsy.push('		<a href="#" onclick="openDetail(\'wfReplyObject\','+ this[0] +');return false;">');
						}
					}else{
						str_index_dbsy.push('		<a href="#" onclick="openDetail(\'wfEntity\','+ this[0] +');return false;">');
					}

					str_index_dbsy.push(this[1].substr(0,10));
					str_index_dbsy.push('		</a>');
					str_index_dbsy.push('	</div>');
					str_index_dbsy.push('</li>');
			    }
			});
			while(ii_dbsy<rowsNumber){
				ii_dbsy++;
				// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
				str_index_dbsy.push('<li><div style="display:none;">____</div></li>');
			}
			if(str_index_dbsy.length>2){
				$("#dbsy_list").prev().hide();
				$("#dbsy_list").html(str_index_dbsy.join(""));
			}

	});

	// 生成最新邮件
	var url_mail="./mailReceiverAction!listAllInboxMailForAjax.shtml?r="	+ Math.random();
	$.getJSON(url_mail,
		function(data){
			if(typeof(data.fail)!="undefined"){
				alert("取最新邮件时出错：" + data.fail);
			}else{
				$("#mail_rows").html(data.totalRows);
			}
			var str_index = createTableList(data.rowDatas,"mail",0,1,2,3);

			if(str_index.length==0){
				str_index.push("<li>暂无相关内容</li>");
			}
			$("#mail_list").prev(".loading").hide();
			$("#mail_list").html(str_index.join(""));
	});

	// 生成最新小贴士
	var url_tips="./wfTipsAction!ajaxTipsList.shtml?r="	+ Math.random();
	$.getJSON(url_tips,
		function(data){
			if(typeof(data.fail)!="undefined"){
				alert("取最新小贴士时出错：" + data.fail);
			}else{
				$("#tips_rows").html(data.totalRows);
			}
			var str_index = createTableList(data.rowDatas,"tips",0,1,2,3,4);

			if(str_index.length==0){
				str_index.push("<li>暂无相关内容</li>");
			}
			$("#tips_list").prev(".loading").hide();
			$("#tips_list").html(str_index.join(""));
	});

	//生成日程安排
	var url_plan="./planSchedulerAction!listForIndex.shtml?r=" + Math.random();
	$.getJSON(url_plan,
			function(data){
				if(typeof(data.fail)!="undefined"){
					alert("取最新日程安排时出错：" + data.fail);
				}else{
					$("#planScheduler_rows").html(data.totalRows);
				}
				var str_index = createTableList(data.rowDatas,"planScheduler",0,1,2,3);

				if(str_index.length==0){
					str_index.push("<li>暂无相关内容</li>");
				}
				$("#planScheduler_list").prev(".loading").hide();
				$("#planScheduler_list").html(str_index.join(""));
	});
	//生成最新归档文件
	var url_docs="./arcInfoSearchAction!ajaxLatestDoc.shtml?r="+Math.random();
	//最新归档文件
	var str_index =new Array();
	var ii = 0;
	$.getJSON(url_docs,
			function(data){
				if(typeof(data.fail)!="undefined"){
					alert("取最新归档文件时出错：" + data.fail);
				}else{
					$("#zxwj_rows").html(data.totalRows);
				}

				$(data.rowDatas).each(function(pend){

					ii++;
					if(ii<=rowsNumber){
						str_index.push('<li>');
						str_index.push('	<div class="title" title="'+this.docTitle+'">');
						str_index.push('		<a href="#" onclick="openDetail(\'zxwj\','+ this.id +');return false;">');
						str_index.push(				this.docTitle);
						//str_index.push('[' + this.fileSignDate + ']');
						str_index.push('		</a>');
						if(this.archiveTime.substring(0,10)==$("#today").val()){
							str_index.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
						}
						str_index.push('	</div>');
						str_index.push('	<div class="date"  title="' + this.fileSignDate + '">');
						str_index.push('		<a href="#" onclick="openDetail(\'zxwj\','+ this.id +');return false;">');
						str_index.push(this.fileSignDate);
						str_index.push('		</a>');
						str_index.push('	</div>');
						str_index.push('</li>');
				    }
				});
				while(ii<rowsNumber){
					ii++;
					// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
					str_index.push('<li><div style="display:none;">____</div></li>');
				}
				if(str_index.length>2){
					$("#zxwj_list").prev().hide();
					$("#zxwj_list").html(str_index.join(""));
				}
	});

	//生成工作计划、工作总结
	for(var i=0;i < planInfo.length;i++){
		createPlanList(planInfo,i);
	}

});



/**
 * 生成最新归档的文件
 */
function createLastestDocList(){
	//最新归档文件
	var str_index =new Array();
	var url="./arcInfoSearchAction!latestDocs.shtml?r=" + Math.random();
	var ii = 0;
	$.getJSON(url,function(data){
		if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
			return;
		}


		$(data.latestDocs).each(function(pend){
//			str_index.push('<li>');
//	   		str_index.push('<a href="###" onclick="opt_detail(this,' + this.id + ');" title="' + this.docTitle + '">' + this.docTitle + '</a>');
//	   		str_index.push('</li>');

			ii++;
			if(ii<=rowsNumber){
			str_index.push('<li>');
			str_index.push('	<div class="title" >');
			str_index.push('		<a href="#" onclick="openDetail(\'zxwj\','+ this.id +');return false;">');
			str_index.push(				this.docTitle);
			str_index.push('[' + this.archiveTime + ']');
			str_index.push('		</a>');
			if(this.archiveTime.substring(0,10)==$("#today").val()){
				str_index.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
			}
			str_index.push('	</div>');
			str_index.push('</li>');
			}
			//ii = ii + 1;
		});

		$("#zxwj_rows").html(ii);

		while(ii<rowsNumber){
			ii++;
			// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
			str_index.push('<li><div style="display:none;">____</div></li>');
		}
		if(str_index.length>2){
			$("ul#zxwj_list").prev().hide();
			$("ul#zxwj_list").html(str_index.join(""));
		}
	});

}


/**
 * 生成待审核工作计划、工作总结
 */
function createPlanList(planInfo,index){
	//最新归档文件
	var str_index =new Array();
	var url="./arcInfoSearchAction!latestDocs.shtml?r=" + Math.random();
	var ii = 0;
	$.getJSON(planInfo[index][1],function(data){
		if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
			return;
		}

		$(data.rowDatas).each(function(plan){
			ii++;
			if(ii<=rowsNumber){
			str_index.push('<li>');
			str_index.push('	<div class="title" >');
			str_index.push('		<a href="#" onclick="openPlan(\'' + planInfo[index][2] + '\',\'' + this[0] + '\','+this[1]+','+this[2]+');return false;">');
			str_index.push(				this[4]);
			str_index.push('		</a>');
			str_index.push('	</div>');
			str_index.push('</li>');
			}
		});

		$("#"+planInfo[index][2]+"_rows").html(data.totalRows);

		while(ii<rowsNumber){
			ii++;
			// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
			str_index.push('<li><div style="display:none;">____</div></li>');
		}
		if(str_index.length>2){
			$("ul#"+planInfo[index][2]+"_list").prev().hide();
			$("ul#"+planInfo[index][2]+"_list").html(str_index.join(""));
		}
	});
}



/**
 * 生成待办事宜等从流程中取值的列表数据
 *
 * @param [] 	toDoInfo		存放了待办信息的数组数据
 * @param int	index			数组下标
 */
function createToDoInfoData(toDoInfo,index){
	$.getJSON(toDoInfo[index][1],$.param(toDoInfo[index][2]),
		function(data){
			if(typeof(data.fail)!="undefined"){
				alert("取" + toDoInfo[index][0] + "时出错：" + data.fail);
			}else{
				$("#" + toDoInfo[index][3] + "_rows").html(data.totalRows);
			}

			var str_index = createTableList(data.rowDatas,"wfEntity","wfStepUserId","title","senderName","createTime","endTime","displayColor");

			if(str_index.length==0){
				str_index.push("<li>暂无相关内容</li>");
			}
			// 隐藏载入状态
			$("#" + toDoInfo[index][3] + "_list").prev().hide();
			// 生成列表数据
			$("#" + toDoInfo[index][3] + "_list").html(str_index.join(""));
	});
}


/**
 * 生成待办事宜列表
 *
 * @param Object[]	 data			数据
 * @param string	 funName		打开详细信息的方法名称
 * @param string	 idName			存放id的属性名
 * @param string	 titleName		存放标题的属性名
 * @param string	 userName		存放姓名的属性名
 * @param string	 timeName		存放时间的属性名
 * @param string	 endTime		存放到期时间的属性名
 * @param string	 displayColor	存放警告级别的属性名
 * @return Array
 */
function createTableList(data,funName,idName,titleName,userName,timeName,endTime,displayColor){
	return __createDbsyList(false,data,funName,idName,titleName,userName,timeName,endTime,displayColor);
}

/**
 * 生成公共信息、相关信息的列表数据
 *
 * @param Object[]	 data			数据
 * @param string	 funName		打开详细信息的方法名称
 * @param string	 idName			存放id的属性名
 * @param string	 titleName		存放标题的属性名
 * @param string	 userName		存放姓名的属性名
 * @param string	 timeName		存放时间的属性名
 * @param string	 endTime		存放到期时间的属性名
 * @return Array
 */
function createInfoTableList(data,funName,idName,titleName,userName,timeName,endTime){
	return __createDbsyList(true,data,funName,idName,titleName,userName,timeName,endTime);
}


/**
 * 	生成数据列表
 *
 * @param boolean	 isShowUserName	是否显示姓名
 * @param Object[]	 data			数据
 * @param string	 dataType		数据类型（用于区分不同的数据类型，以执行不同的查看详细信息的方法）
 * @param string	 idName			存放id的属性名
 * @param string	 titleName		存放标题的属性名
 * @param string	 userName		存放姓名的属性名
 * @param string	 timeName		存放时间的属性名
 * @param string	 endTime		存放到期时间的属性名
 * @return {}
 */
function __createDbsyList(isShowUserName,data,dataType,idName,titleName,userName,timeName,endTime,displayColor){
	var n=0;
	var str_index=new Array();
	var _rows=rowsNumber;
	if(dataType=="planScheduler" || dataType=="mail" ){
		_rows=6;
	}
	if(typeof(data)!="undefined" && typeof(data.fail)=="undefined" && data.length>0){
		$(data).each(function(index,sysPendings){

			n++;
			if(n<=_rows){
				/*
				str_index.push('<li><a href="#" onclick="openWfEntity('+this.wfStepUserId+');return false;">'
							+sysPendings.title + '--' + sysPendings.senderName + '--' + sysPendings.createTime
							+'</a></li>');
				*/
				str_index.push('<li>');
				//添加replace(/"/g,"”")的目的：防止首页链接点不动
				str_index.push('	<div class="title" title="' + this[titleName].replace(/"/g,"”"));
				if(!isEmpty(this[userName])){
					str_index.push('[' + this[userName] + ']');
				}
				if(!isEmpty(this[endTime])){
					str_index.push('[' + this[endTime] + ']');
				}

				str_index.push('	">');
				//alert('		<a href="#" onclick="openDetail(\"' + dataType + '\",'+this[idName]+');return false;">');

				if(typeof(this)=="object" && this["libId"]!=undefined && parseInt(this["libId"])==5){
					if(!isEmpty(this["isRead"])&&this["isRead"]===1){
						str_index.push('<a style="color:gray;font-weight:bolder" href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
					}else{
						str_index.push('<a style="color:red;font-weight:bolder" href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
					}
				}else if(typeof(this)=="object" && this["libId"]!=undefined && parseInt(this["libId"])==1){

					//alert(this[displayColor]);
					if(!isEmpty(this[displayColor])&&this[displayColor]=="yellow"){
						str_index.push('<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
						str_index.push('	<img border=0 src="' + _skinPath + '/images/lightY16.gif">');
					}else if(!isEmpty(this[displayColor])&&this[displayColor]=="red"){
						str_index.push('<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
						str_index.push('	<img border=0 src="' + _skinPath + '/images/lightR16.gif">');
					}else{
						str_index.push('<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
					}

				}else{
					str_index.push('<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
				}

				if(dataType=="tips"){

					if(!isEmpty(this[endTime]) && this[endTime]!=1){
						str_index.push("[未阅]");
						str_index.push(		this[titleName].replace(/"/g,"”"));
					}else{
						str_index.push(		this[titleName].replace(/"/g,"”"));
					}

					if(isShowUserName==true){	// 是否显示姓名
						str_index.push('[<font color="blue">' + this[userName] + ']</font>');
					}
				}else{
					str_index.push(		this[titleName].replace(/"/g,"”"));
					if(isShowUserName==true){	// 是否显示姓名
						str_index.push('[<font color="blue">' + this[userName] + ']</font>');
					}
					if(!isEmpty(this[endTime])){
						str_index.push('[<font color="blue">' + this[endTime] + ']</font>');
					}
				}


				if(this[timeName].substring(0,10)==$("#today").val()){
					str_index.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
				}
				str_index.push('		</a>');
				str_index.push('	</div>');
				str_index.push('	<div class="date"  title="' + this[timeName] + '">');
				str_index.push('		<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
				if(isShowUserName==true){	// 是否显示姓名
					str_index.push(this[timeName]);
				}else{
					str_index.push(	this[timeName].substring(0,10));
				}
				str_index.push('		</a>');
				str_index.push('	</div>');
				str_index.push('</li>');
			}
		});
	}
	while(n<_rows){
		n++;
		// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
		str_index.push('<li><div style="display:none;">____</div></li>');
	}
	return str_index;
}






function openDetailFqb(){

}

/**
 * 点击某条数据，打开查看数据的窗口
 *
 * @param String	type	数据的类型
 * @param int		id		数据的id
 */
function openDetail(type,id){
	if(isEmpty(id)){
		alert("查看内容的id不能为空！");
		return;
	}
	var url = "";
	switch(type){
		case    "wfReplyObjectFqb":						//批示新版
			url="./wfPeriodsInfoAction!listByEntityPeriodsRead.shtml?pendingId=" + id;
			break;
		case    "wfReplyObject":						//批示新版
			url="./wfEntityAction!detailForReplyObject.shtml?sysPendings.id=" + id;
			break;
		case    "pishi":						//最新批示
			url="./wfEntityAction!detail.shtml?wfEntity.id=" + id;
			break;
		case	"wfEntity":					// 待办事宜、待办会议、待办文件、待阅文件
			url = "./wfEntityAction!detail.shtml?wfStepUser.id=" + id;
			break;
		case	"mail":						// 最新邮件
//			url = "./mailMessageAction!detail.shtml?returnType=info&mailMessage.id=" + id;		// james的电子邮件
			url = "./mailContentAction!detail.shtml?recId=" + id+"&listType=in";		// db电子邮件
			break;
		case	"kld":						// 公共资料库
			url = "kldAction!detail.shtml?kldContent.id=" + id;
			break;
		case	"myselfKld":				// 我的资料库。直接进入到修改状态
			url = "kldAction!modifyContent.shtml?returnType=info&kldContent.id=" + id;
			break;
		case	"infoContent":				// 通知公告、新闻简报
			url = "infoContentAction!viewDetail.shtml?infoContent.id=" + id;
			break;
		case	"planScheduler":			// 日程安排
			url = "./planSchedulerAction!detail.shtml?planScheduler.id=" + id;
			break;
		case	"bbsTopic":					// 内部论坛
			url = "./bbsTopicAction!detail.shtml?bbsTopic.id=" + id;
			break;
		case	"zxwj":					// 最新归档文件
			url = "./arcInfoSearchAction!detail.shtml?arcInfo.id=" + id;
			break;
		case	"xxsbPublication":
			url=xxsb_url+"xxPublicationAction!pdfDetail.shtml?xxPublication.id="+id;
			break;
		case "zbrz":
			url="./dutyDiaryAction!detail.shtml?dutyDiary.id="+id;
			break;
		case "sfFile" :
            url = "./wfEntityAction!simulateRealDetail.shtml?wfEntityIdReader=" + id;
            break;
		case "psFile" :
            url = "./wfEntityAction!simulateRealDetail.shtml?wfEntityIdReader=" + id;
            break;
		case "kldByLeader":
			 url = "./kldAction!detail.shtml?kldContent.id=" + id;
			break;
		case "tips":
			 url = "./wfTipsAction!ajaxDetail.shtml?wfTips.id=" + id;
			break;
		case "weekTodo":
			 url = "./weekRecordAction!detail.shtml?sysPendingsId=" + id;
			break;
		case "weekReview":
			 url = "./weekReviewAction!detail.shtml?sysPendingsId=" + id + "&isLeader=1";;
			break;
		default	:
			alert("请指定要打开的数据的类型！");
			break;
	}

	if(type=="tips"){

		//alert(url);
		$.getJSON(url,function(data){
			if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
				return;
			}

			var strArr = new Array();
			strArr.push('<table class=\"tbl\"><caption>小贴士</caption>');
			strArr.push('	<thead>');
			strArr.push('		<th  bgcolor=\"#ebf2ff\" style=\"text-align: center\" height=\"25px\" align=\"center\" width=\"15%\">发送人</th>');
			strArr.push('		<th  bgcolor=\"#ebf2ff\" style=\"text-align: center\" height=\"25px\" align=\"center\" width=\"15%\">发送时间</th>');
			strArr.push('		<th  bgcolor=\"#ebf2ff\" style=\"text-align: center\" height=\"25px\" align=\"center\" width=\"65%\">内容</th>');
			strArr.push('	</thead>');
			strArr.push('	<tbody>');
			strArr.push('		<tr height=\"25px\">');
			strArr.push('			<td align="center">'+data.content.senderName+'</td>');
			strArr.push('			<td align="center">'+data.content.sendTime+'</td>');
			if(data.content.contentType==1){
				strArr.push('			<td align=\"center\">'+data.content.content+'</td>');
			}else{
				strArr.push('			<td align=\"center\"><div id=\"att_'+data.content.docDataId+'\"></div></td>');
			}
			strArr.push('		</tr>');
			strArr.push('		<script>');
			strArr.push('			$(function() {$(\"#att_'+data.content.docDataId+'\").showAttachment(\"WF_TIPS\",\"'+data.content.docDataId+'\",{})});');
			strArr.push('		</script>');
			strArr.push('	</tbody>');
			strArr.push('</table>');

			var re = strArr.join("") ;
			//alert(re);
			$("#tipsContent").html(re);
			//alert("html的内容是："+$("#tipsContent").html());
			dialog("小贴士内容", "id:tipsContent", "800px", "auto", "text");
		});

	}else{

		if(type=="wfEntity"){

			// 打开详情前，先判断是否需要签收（条件：1、其他单位的发文  2、当前人员在wf_step_user中的人员类型是PUBLISHER），如何需要的话，则需先签收，在
			$.getJSON("./wfEntityAction!ajaxCheckIsSign.shtml?wfStepUser.id=" + id,function(data){

				if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
					alert("校验是否需要签收且已经签收时异常！");
					return;
				}else{

						// 校验结果需要签收，且未签收的场合
		            	if(data.result=="success"){

		            		if(confirm("该文件您尚未签收无法查看详情，是否签收？")){

		            			$.getJSON("./wfEntityAction!ajaxSign.shtml?wfStepUser.id=" + id,function(data){
		            				if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
		            					alert("执行签收动作时异常！");
		            					return;
		            				}else{
		            					// 校验结果需要签收，且未签收的场合
		        		            	if(data.result=="success"){

		        		            		alert("签收成功！");
		        		            		//如果存在未读小贴士，需要先打开小贴士
		        		                	$.getJSON("./wfEntityAction!ajaxCheckTips.shtml?wfStepUser.id=" + id,function(data){
		        		                		if(data.result=="success"){
		                                              var  uurl="./wfEntityAction!showTips.shtml?wfStepUser.id=" + id;
		                                                   artDialog.open(uurl,{   
		                                                       id     : "tipsDialog",
		                                                       title  : "小贴士",
		                                                       lock   : true,
		                                                       width  : 850,
		                                                       height : 500,
		                                                       ok: function(){
		        		            		
							        		            		//临时存放form的action值，为后面恢复用
							        		            		var formAction=$("form").eq(0).attr("action");
							        		            		var winName = getNewWinName();
							        		            	   	$("form").eq(0).attr("action",url).attr("target",winName);
							        		            		openNewWin("",null,null,winName);
					
							        		            		$("form").eq(0).submit();
							        		            		// 恢复默认打开的窗口
							        		            		$("form:eq(0)").attr("target","");
							        		            		//恢复原form的action值
							        		            		$("form").eq(0).attr("action",formAction);
							        		            		//$("#" + domainName + "\\.id").val("");
		                                                       },
				                                                okVal   :   '确定'
				                                             });          
				                                     }else if(data.result=="fail"){
				                                    	   //临时存放form的action值，为后面恢复用
						        		            		var formAction=$("form").eq(0).attr("action");
						        		            		var winName = getNewWinName();
						        		            	   	$("form").eq(0).attr("action",url).attr("target",winName);
						        		            		openNewWin("",null,null,winName);
				
						        		            		$("form").eq(0).submit();
						        		            		// 恢复默认打开的窗口
						        		            		$("form:eq(0)").attr("target","");
						        		            		//恢复原form的action值
						        		            		$("form").eq(0).attr("action",formAction);
						        		            		//$("#" + domainName + "\\.id").val("");
				                                      }
		        		                	});
		        		            	}else{
		        		            		alert("签收失败，无法打开详情！");
		        		            		return;
		        		            	}
		            				}

		            			});
		            		}else{
		            			return;
		            		}
						// 校验结果无需签收或需要签收，但已签收的场合
		                }else if(data.result=="fail"){
		                	//如果存在未读小贴士，需要先打开小贴士
		                	$.getJSON("./wfEntityAction!ajaxCheckTips.shtml?wfStepUser.id=" + id,function(data){
		                		if(data.result=="success"){
                                      var  uurl="./wfEntityAction!showTips.shtml?wfStepUser.id=" + id;
                                           artDialog.open(uurl,{   
                                               id     : "tipsDialog",
                                               title  : "小贴士",
                                               lock   : true,
                                               width  : 850,
                                               height : 500,
                                               ok: function(){
								                	//临时存放form的action值，为后面恢复用
								            		var formAction=$("form").eq(0).attr("action");
								            		var winName = getNewWinName();
								            	   	$("form").eq(0).attr("action",url).attr("target",winName);
								            		openNewWin("",null,null,winName);
						
								            		$("form").eq(0).submit();
								            		// 恢复默认打开的窗口
								            		$("form:eq(0)").attr("target","");
								            		//恢复原form的action值
								            		$("form").eq(0).attr("action",formAction);
								            		//$("#" + domainName + "\\.id").val("");
		                                                },
		                                                okVal   :   '确定'
		                                             });          
                                     }else if(data.result=="fail"){
                                   	   //临时存放form的action值，为后面恢复用
						            		var formAction=$("form").eq(0).attr("action");
						            		var winName = getNewWinName();
						            	   	$("form").eq(0).attr("action",url).attr("target",winName);
						            		openNewWin("",null,null,winName);
				
						            		$("form").eq(0).submit();
						            		// 恢复默认打开的窗口
						            		$("form:eq(0)").attr("target","");
						            		//恢复原form的action值
						            		$("form").eq(0).attr("action",formAction);
						            		//$("#" + domainName + "\\.id").val("");
                                     }
		                	});
		                	
		                }else if(data.result=="exception"){

		                	alert("校验是否需要签收时出现系统指定情况异常！");
		                	return;
		                }

				}

			});
		}else if(type=="zxwj"){

			// 打开详情前，先判断是否需要签收（条件：1、其他单位的发文  2、当前人员在wf_step_user中的人员类型是PUBLISHER），如何需要的话，则需先签收，在
			$.getJSON("./wfEntityAction!ajaxCheckIsSign.shtml?arcInfo.id=" + id,function(data){

				if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
					alert("校验是否需要签收且已经签收时异常！");
					return;
				}else{

						// 校验结果需要签收，且未签收的场合
		            	if(data.result=="success"){

		            		if(confirm("该文件您尚未签收无法查看详情，是否签收？")){

		            			$.getJSON("./wfEntityAction!ajaxSign.shtml?arcInfo.id=" + id,function(data){
		            				if(typeof(data)=="undefined" || typeof(data.fail)!="undefined"){
		            					alert("执行签收动作时异常！");
		            					return;
		            				}else{
		            					// 校验结果需要签收，且未签收的场合
		        		            	if(data.result=="success"){

		        		            		alert("签收成功！");
		        		            		//临时存放form的action值，为后面恢复用
		        		            		var formAction=$("form").eq(0).attr("action");
		        		            		var winName = getNewWinName();
		        		            	   	$("form").eq(0).attr("action",url).attr("target",winName);
		        		            		openNewWin("",null,null,winName);

		        		            		$("form").eq(0).submit();
		        		            		// 恢复默认打开的窗口
		        		            		$("form:eq(0)").attr("target","");
		        		            		//恢复原form的action值
		        		            		$("form").eq(0).attr("action",formAction);
		        		            		//$("#" + domainName + "\\.id").val("");

		        		            	}else{
		        		            		alert("签收失败，无法打开详情！");
		        		            		return;
		        		            	}
		            				}

		            			});
		            		}else{
		            			return;
		            		}
						// 校验结果无需签收或需要签收，但已签收的场合
		                }else if(data.result=="fail"){
		                	//临时存放form的action值，为后面恢复用
		            		var formAction=$("form").eq(0).attr("action");
		            		var winName = getNewWinName();
		            	   	$("form").eq(0).attr("action",url).attr("target",winName);
		            		openNewWin("",null,null,winName);

		            		$("form").eq(0).submit();
		            		// 恢复默认打开的窗口
		            		$("form:eq(0)").attr("target","");
		            		//恢复原form的action值
		            		$("form").eq(0).attr("action",formAction);
		            		//$("#" + domainName + "\\.id").val("");
		                }else if(data.result=="exception"){

		                	alert("校验是否需要签收时出现系统指定情况异常！");
		                	return;
		                }

				}

			});

		}else{
			//临时存放form的action值，为后面恢复用
    		var formAction=$("form").eq(0).attr("action");
    		var winName = getNewWinName();
    	   	$("form").eq(0).attr("action",url).attr("target",winName);
    		openNewWin("",null,null,winName);

    		$("form").eq(0).submit();
    		// 恢复默认打开的窗口
    		$("form:eq(0)").attr("target","");
    		//恢复原form的action值
    		$("form").eq(0).attr("action",formAction);
    		//$("#" + domainName + "\\.id").val("");
		}

	}

}

/**
 * 点击某条数据，打开查看数据的窗口(工作计划、工作总结)
 *
 * @param String	type	数据的类型
 * @param String	year	年度
 * @param int		week	周次
 * @param int		deptid	处室id
 */
function openPlan(type,year,week,deptId) {
	var url = "";
	switch(type){
		case "gzjh":						//最新批示
			url = "./planWorkAction!openCheckM.shtml?year="+year+"&week="+week+"&sysDept.id="+deptId;
			break;
		case "gzzj":						//最新批示
			url = "./planProgressAction!openCheckM.shtml?year="+year+"&week="+week+"&sysDept.id="+deptId;
			break;
	}

	//临时存放form的action值，为后面恢复用
	var formAction=$("form").eq(0).attr("action");
	var winName = getNewWinName();
   	$("form").eq(0).attr("action",url).attr("target",winName);
	openNewWin("",null,null,winName);

	$("form").eq(0).submit();
	// 恢复默认打开的窗口
	$("form:eq(0)").attr("target","");
	//恢复原form的action值
	$("form").eq(0).attr("action",formAction);
	//$("#" + domainName + "\\.id").val("");
}

//领导首页打开查询所跳转的页面处理
function openQuery(type){
	var url = "";
	var title = "";
	switch(type){
		case	"latestPishi":
			url="./wfEntityListAction!leaderIndexLookPishi.shtml";
			title="批示查询";
			break;
		case	"toDeal":					// 待办事宜
			url = "./sysPendingsAction!getToDealList.shtml";
			title = "待办事宜";
			break;
		case	"toDealFile":				// 待办文件
			url = "./sysPendingsAction!getToDealList.shtml?wfLibIds=" + wbLibIdsForFile;
			title = "待办文件";
			break;
		case	"toReadFile":				// 待阅文件
			url = "./sysPendingsAction!getToReadList.shtml?wfLibIds=" + wbLibIdsForFile;
			title = "待阅文件";
			break;
		case	"mail":						// 最新邮件
//			url = "./mailMessageAction!listAllInboxMail.shtml";		//james的电子邮件
			url = "./mailReceiverAction!list.shtml?listType=in";		//db电子邮件
			title = "邮件查询";
			break;
		case	"planScheduler":			//日程安排
			url="./planSchedulerAction!list.shtml";
			title="日程查询";
			break;
		case	"zxwj":					//归档文件
			url = "./arcInfoSearchAction!index.shtml";
			title="文件查询";
			break;
		case	"xxsbPublication":
			url=xxsb_url+"xxPublicationAction!oaQueryPublicationPage.shtml";
			title="刊物查询";
			break;
		case "toDutyDiary":
			url="./dutyDiaryAction!leaderListEx.shtml";
			title="值班查询";
			break;
		case "kldByLeader":
			 url = "。/kldAction!list.shtml?kldGroup.id=2";
			 title="最新资料";
			break;
	}
	if(!isEmpty(url)){
		if(typeof(parent.openMenuItem)=="function"){
			parent.openMenuItem(url,title);
		}else{
			$("form").eq(0).attr("action",url);
			$("form").eq(0).submit();
		}
	}
}
// 打开“更多”
function openMore(type){
	var url = "";
	var title = "";
	switch(type){
		case	"latestPishi":
			url="./wfEntityListAction!queryLatestFinshiedPishiByPishiren.shtml";
			title="最新批示";
			break;
		case	"toDeal":					// 待办事宜
			url = "./sysPendingsAction!getToDealList.shtml?wfLibIds="+wbLibIdsForDbsy;
			title = "待办事宜";
			break;
		case	"toDealMeeting":			// 待办会议
			url = "./sysPendingsAction!getToReadList.shtml?wfLibIds=" + wbLibIdsForMeeting;
			title = "待办会议";
			break;
		case	"toDealFile":				// 待办文件
			url = "./sysPendingsAction!getToDealList.shtml?wfLibIds="+wbLibIdsForFile;  //sysPendingsAction!getToReadList.shtml 直接跳转到待阅
			title = "待办文件";
			break;
		case	"toReadFile":				// 待阅文件
			url = "./sysPendingsAction!getToReadList.shtml?wfLibIds=" + wbLibIdsForFile;
			title = "待阅文件";
			break;
		case	"mail":						// 最新邮件
//			url = "./mailMessageAction!listAllInboxMail.shtml";		//james的电子邮件
			url = "./mailReceiverAction!list.shtml?listType=in";		//db电子邮件
			title = "最新邮件";
			break;
		case	"kld":						// 资料库
			url = "./kldAction!list.shtml?kldGroup.id=2";
			title = "资料库";
			break;
		case	"tips":						// 资料库
			url = "./wfTipsAction!list.shtml";
			title = "小贴士";
			break;
		case	"planScheduler":			//日程安排
			url="./planSchedulerAction!list.shtml";
			title="日程安排";
			break;
		case	"zxwj":					//归档文件
			url = "./arcInfoSearchAction!latestPageHomeList.shtml";
			title="归档文件";
			break;
		case "psFile":
			url="./sysPendingsAction!onlySeeFileOpenMore.shtml?"+$.param({"wfLibIds":wbLibIdsForDbsy});
			title="批示文件";
			break;
		case "sfFile":
			url="./sysPendingsAction!onlySeeFileOpenMore.shtml?"+$.param({
		         "sysPendings.type": "DEAL",
		         "sysPendings.isDeal": 0,
		         "wfLibIds": wbLibIdsForFile
		     });
			title="收发文件";
			break;
		case	"xxsbPublication":
			url=xxsb_url+"xxPublicationAction!browseList.shtml?listType=publication";
			title="最新刊物";
			break;

		case	"gzjh":
			url="./planWorkAction!noCheckList.shtml";
			title="工作计划";
			break;
		case	"gzzj":
			url="./planProgressAction!noCheckList.shtml";
			title="工作总结";
			break;
			
		case	"week_todo":
			url="./weekRecordAction!list.shtml?statusType=3&editState=newdb";
			title="待办理";
			break;
		case	"week_check":
			url="./weekReviewAction!reviewList.shtml";
			title="待审核";
			break;
	}
	if(!isEmpty(url)){
		if(typeof(parent.openMenuItem)=="function"){
			parent.openMenuItem(url,title);
		}else{
			$("form").eq(0).attr("action",url);
			$("form").eq(0).submit();
		}
	}
}

/**
 * 点击公共信息、相关信息中的“更多”
 *
 * @param int index
 */
function moreInfo(urlInfo,index){
	var url = urlInfo[index][3];
	var title = urlInfo[index][0];
	if(isEmpty(url)){
		alert("'更多'信息的的url地址未指定！");
		return;
	}
	if(!isEmpty(url)){
		if(typeof(parent.openMenuItem)=="function"){
			parent.openMenuItem(url,title);
		}else{
			$("form").eq(0).attr("action",url);
			$("form").eq(0).submit();
		}
	}
}



/**
 * 生成信息、相关信息的列表
 *
 * @param Array		urlInfo		生成数据的url地址数组
 * @param int		index		要处理的数组下标
 * @param jqueryObj $divCont	存放列表的jquery容器
 */
function createDataList(urlInfo,index,$divCont){
	if(typeof(urlInfo[index][1])=="undefined" || isEmpty(urlInfo[index][1])){
		return;
	}
	var n=0;
	var str_index=new Array();
	//alert("index:" + index + "  url:" + urlInfo[index][0]);
	$.getJSON(urlInfo[index][1],function(data){
		if(typeof(data.fail)!="undefined"){
			alert("取公共信息[" + index + "]出错：" + data.fail);
		}else{
			$("ul.subchannel li",$divCont).eq(index).find("span").html(data.totalRows);
		}

		var str_index = createInfoTableList(data.rowDatas,urlInfo[index][2],0,1,2,3);

		/*
		if(str_index.length==0){
			str_index.push("<li>暂无相关内容</li>");
		}
		*/

		$(".mod .loading",$divCont).eq(index).css("display","none");;
		$(".mod .modlist",$divCont).eq(index).html(str_index.join(""));

		// 将url清空
		urlInfo[index][1] = "";
	});


	if(index==0){	// 第一次调用时，先生成各个列表内容的条数
		for(var ii=1;ii<urlInfo.length;ii++){
			setInfoRowsData(urlInfo,ii,$divCont);
		}
	}
}

/**
 * 生成信息列表的“数据条数”值
 *
 * @param Array		urlInfo		生成数据的url地址数组
 * @param int		index		要处理的数组下标
 * @param jqueryObj $divCont	存放列表的jquery容器
 */
function setInfoRowsData(urlInfo,index,$divCont){
	if(typeof(urlInfo[index][1])=="undefined" || isEmpty(urlInfo[index][1])){
		return;
	}
	$.getJSON(urlInfo[index][1],function(data){
		if(typeof(data.totalRows)!="undefined"){
			$("ul.subchannel li span",$divCont).eq(index).html(data.totalRows);
		}
	});
}









/**
 * 生成日程安排的日历
 */
function getPlanScheduler(){
	// 生成日程的日历
	// 取得日程安排数据，生成日历
	$.ajax({
			type : "POST",
			url : "./planSchedulerAction!getYearDatasForUser.shtml",
			data : '',
			dataType: "json",
			success : function(data) {
				if(typeof(data.fail)!="undefined"){
					alert("取得本人的年度日程安排时出错：" + data.fail);
					return;
				}
				scheduler.config.xml_date = "%Y-%m-%d %H:%i";
				scheduler.init('scheduler_here', new Date(), "day");
				// 载入日程安排数据
				scheduler.parse(data,"json");
				scheduler.renderCalendar({
							container:"mini_here",
							date : scheduler._date,
							navigation : true,
							handler : function(date, calendar) {
								alert(date.format());
							}
						});
			},
			error : function() {
				alert("取得本人的年度日程安排时出错!");
			}
	});
}



/**
 * 提取党政信息报送系统中的【最新刊物】
 * 显示到homepage中
 */
function loadXxsbPublication(){
	//http://192.168.1.22:8080/xxsb/xxPublicationAction!listPublication.shtml
	//xxsb_url 在homePage.ftl中声明是全局变量
	var _url=xxsb_url+"loginAction!oaLogin.shtml";
	var _isOASign=true;
	var _data="loginInfo="+encodeURI(loginInfo)+"&isOASign="+_isOASign+"&isOptLogin=true";
	/*************************发送登录请求**************************************/
    $.ajax({
	   type: "GET",
	   async: false,
	   url: _url,
	   data:_data,
	   dataType:"jsonp",
	   jsonp:"callback",
	   success: function(msg){
		  /*******************登录成功后，再请求最新刊物*******************************/
		   var _url=xxsb_url+"xxPublicationAction!listPublicationToOA.shtml?r="+Math.random();
			 $.ajax({
				   type: "GET",
				   async: false,
				   url: _url,
				   dataType:"jsonp",
				   jsonp:"callback",
				   success: function(data){
					   if(typeof(data.fail)!="undefined"){
							alert("取最新刊物时出错：" + data.fail);
						}else{
							$("#xxsbPublication_rows").html(data.totalRows);
						}
					   	//leaderRowsNumber||6 表示领导登录时根据领导要求显示的条数进行显示，普通用户为6条
					    var str_index = createPublicationList(leaderRowsNumber||6,true,data.rowDatas,"xxsbPublication",0,1,2,3,4,5,6);
						if(str_index.length==0){
							str_index.push("<li>暂无相关内容</li>");
						}
						$("#xxsbPublication_list").prev(".loading").hide();
						$("#xxsbPublication_list").html(str_index.join(""));
				   }
			});

	  }
	});

}


/**
 * 	生成最新刊物数据列表
 *
 * @param boolean	 isShowUserName	是否显示姓名
 * @param Object[]	 data			数据
 * @param string	 dataType		数据类型（用于区分不同的数据类型，以执行不同的查看详细信息的方法）
 * @param string	 idName			存放id的属性名
 * @param string	 titleName		存放标题的属性名
 * @param string	 kwName			存放刊物名称的属性名
 * @param string	 kwAlisName		存放刊物副名称的属性名
 * @param string	 yearNum		存放期刊期号的属性名
 * @param string	 userName		存放姓名的属性名
 * @param string	 timeName		存放时间的属性名
 * @param string	 endTime		存放到期时间的属性名
 * @return {}
 */
function createPublicationList(rowsNumber,isShowUserName,data,dataType,idName,titleName,kwName,kwAlisName,yearNum,userName,timeName,endTime){
	var n=0;
	var str_index=new Array();
	if(typeof(data)!="undefined" && typeof(data.fail)=="undefined" && data.length>0){
		$(data).each(function(i){
			n++;
			if(n<=rowsNumber){
				str_index.push('<li>');
				str_index.push('	<div class="title" title="' + this[kwName]);
				if(!isEmpty(this[kwAlisName])){
					str_index.push('(' + this[kwAlisName] + ')');
				}
				str_index.push('(' + this[yearNum] + ')');
				if(!isEmpty(this[titleName])){
					str_index.push(this[titleName]);
				}
				if(!isEmpty(this[userName])){
					str_index.push('[' + this[userName] + ']');
				}
				if(!isEmpty(endTime)){
					if(!isEmpty(this[endTime]))
						str_index.push('[' + this[endTime] + ']');
				}
				str_index.push('	">');
				//alert('		<a href="#" onclick="openDetail(\"' + dataType + '\",'+this[idName]+');return false;">');
				str_index.push('		<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
				str_index.push(this[kwName]);
				if(!isEmpty(this[kwAlisName])){
					str_index.push('(' + this[kwAlisName] + ')');
				}
				str_index.push('(' + this[yearNum] + ')');
				if(!isEmpty(this[titleName])){
					str_index.push(this[titleName]);
				}
				if(isShowUserName==true){	// 是否显示姓名
					if(!isEmpty(this[userName])){
						str_index.push('[' + this[userName] + ']');
					}
				}
				if(!isEmpty(endTime) ){
					if(!isEmpty(this[endTime]))
						str_index.push('[' + this[endTime] + ']');
				}
				if(this[timeName].substring(0,10)==$("#today").val()){
					str_index.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
				}
				str_index.push('		</a>');
				str_index.push('	</div>');
				str_index.push('	<div class="date"  title="' + this[timeName] + '">');
				str_index.push('		<a href="#" onclick="openDetail(\'' + dataType + '\','+this[idName]+');return false;">');
				//if(isShowUserName==true){	// 是否显示姓名
				//	str_index.push(this[timeName]);
				//}else{
					str_index.push(	this[timeName].substring(0,10));
				//}
				str_index.push('		</a>');
				str_index.push('	</div>');
				str_index.push('</li>');
			}
		});
	}
	while(n<rowsNumber){
		n++;
		// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
		str_index.push('<li><div style="display:none;">____</div></li>');
	}
	return str_index;
}
/**
 * 加载针对领导所用首页的批示list
 */
function loadLastestPishiList(){
	var url_docs="./wfEntityListAction!ajaxLatestFinishedPishiListByPishiren.shtml?r="+Math.random();
	var str_index =new Array();
	var ii = 0;
	$.getJSON(url_docs,{"number":"10"},
			function(data){
			if(typeof(data.fail)!="undefined"){
				alert("取最新批示时出错：" + data.fail);
			}else{
				$("#latestPishi_rows").html(data.total);
			}
				data=data.data;
				$.each(data,function(){
					ii++;
					if(ii<=rowsNumber){
						str_index.push('<li>');
						str_index.push('	<div class="title" >');
						str_index.push('		<a href="#" onclick="openDetail(\'pishi\','+ this[0] +');return false;">');
						str_index.push(				this[1]);
						str_index.push('		</a>');
						if(this[3].substring(0,10)==$("#today").val()){
							str_index.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
						}
						str_index.push('	</div>');
						str_index.push('	<div class="date"  title="' + this[1] + '['+this[2]+']">');
						str_index.push('		<a href="#" onclick="openDetail(\'pishi\','+ this[0] +');return false;">');
						str_index.push(this[3].substring(0,10));
						str_index.push('		</a>');
						str_index.push('	</div>');
						str_index.push('</li>');
				    }
				});

				while(ii<rowsNumber){
					ii++;
					// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
					str_index.push('<li><div style="display:none;">____</div></li>');
				}
				if(str_index.length>2){
					$("#latestPishi_list").prev().hide();
					$("#latestPishi_list").html(str_index.join(""));
				}
	});
}

function loadDutyDiaryList(){
	var url_docs="./dutyDiaryAction!ajaxAllDutyDiary.shtml?r="+Math.random();
	var str_index =new Array();
	var ii = 0;
	$.getJSON(url_docs,{"number":"10"},function(data){

		if(typeof(data.fail)!="undefined"){
			alert("取最新批示时出错：" + data.fail);
		}else{
			$("#zbrz_rows").html(data.totalRows);
		}
		$.each(data.rowDatas,function(){
			ii++;
			if(ii<=rowsNumber){
				str_index.push('<li>');
				str_index.push('	<div class="title" >');
				str_index.push('		<a href="#" onclick="openDetail(\'zbrz\','+ this[0] +');return false;">');
				str_index.push(				this[1]+'\t['+this[2]+']值班记录') ;
				str_index.push('		</a>');
				if(this[3].substring(0,10)==$("#today").val()){
					str_index.push('	<img border=0 src="' + _skinPath + '/images/homePage/new.gif">');
				}
				str_index.push('	</div>');
				str_index.push('	<div class="date"  title="' + this[1] + '['+this[2]+']">');
				str_index.push('		<a href="#" onclick="openDetail(\'zbrz\','+ this[0] +');return false;">');
				str_index.push(this[3].substring(0,10));
				str_index.push('		</a>');
				str_index.push('	</div>');
				str_index.push('</li>');
		    }
		});

		while(ii<rowsNumber){
			ii++;
			// 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
			str_index.push('<li><div style="display:none;">____</div></li>');
		}
		if(str_index.length>2){
			$("#zbrz_list").prev().hide();
			$("#zbrz_list").html(str_index.join(""));
		}

	});
}
function loadSfFile(param) {
	if($("#sfFile_list").length<1) return ;
    var url_docs = "./sysPendingsAction!getSysPendingsForCurUserOrg.shtml";

    var str_index = new Array();
    var ii = 0;
    $.getJSON(
        url_docs,
        $.param(param),
        function (data) {

            if (typeof (data.fail) != "undefined") {
                alert("取最新批示时出错：" + data.fail);
            } else {
                $("#sfFile_rows").html(data.totalRows);
            }
            $.each(data.rowDatas,function () {
                    ii++;
                    if (ii <= rowsNumber) {
                    	var status="";
                    	if(this[3]==="FINISH"){
                    		status="[发布]";
                    	}
                        str_index.push('<li>');
                        str_index.push('	<div class="title" >');
                        str_index.push('		<a href="#" onclick="openDetail(\'sfFile\','+ this[0]+ ');return false;">');
                        str_index.push(this[1]+status);
                        str_index.push('		</a>');
                        if (this[2].substring(0, 10) == $("#today").val()) {
                            str_index.push('	<img border=0 src="' + _skinPath+ '/images/homePage/new.gif">');
                        }
                        str_index.push('	</div>');
                        str_index.push('	<div class="date"  title="'+ this[1]+ '['+ this[2]+ ']">');
                        str_index.push('		<a href="#" onclick="openDetail(\'sfFile\','+ this[0]+ ');return false;">');
                        str_index.push(this[2].substring(0, 10));
                        str_index.push('		</a>');
                        str_index.push('	</div>');
                        str_index.push('</li>');
                    }
                });

            while (ii < rowsNumber) {
                ii++;
                // 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
                str_index.push('<li><div style="display:none;">____</div></li>');
            }
            if (str_index.length > 2) {
                $("#sfFile_list").prev().hide();
                $("#sfFile_list").html(str_index.join(""));
            }
        });
}
function loadKldByLeader(param){
	if($("#kldByLeader_list").length<1) return ;
	var url_docs = "./kldAction!showListJSON.shtml?r=" + Math.random();;

	  var str_index = new Array();
	    var ii = 0;
	    $.getJSON(
	        url_docs,
	        $.param(param),
	        function (data) {

	            if (typeof (data.fail) != "undefined") {
	                alert("取最新资料时出错：" + data.fail);
	            } else {
	                $("#kldByLeader_rows").html(data.kldContents.length);
	            }
	            $.each(data.kldContents,function () {
	                    ii++;
	                    if (ii <= rowsNumber) {
	                        str_index.push('<li>');
	                        str_index.push('	<div class="title" >');
	                        str_index.push('		<a  href="#" onclick="openDetail(\'kldByLeader\','+ this.id+ ');return false;">');
	                        str_index.push(this.title);
	                        str_index.push('		</a>');
	                        if (this.uploadTime.substring(0, 10) == $("#today").val()) {
	                            str_index.push('	<img border=0 src="'+ _skinPath+ '/images/homePage/new.gif">');
	                        }
	                        str_index.push('	</div>');
	                        str_index.push('	<div class="date"  title="'+ this.title+ '['+ this.uploadTime+ ']">');
	                        str_index.push('		<a href="#" onclick="openDetail(\'kldByLeader\','+ this.id+ ');return false;">');
	                        str_index.push(this.uploadTime.substring(0, 10));
	                        str_index.push('		</a>');
	                        str_index.push('	</div>');
	                        str_index.push('</li>');
	                    }
	                });

	            while (ii < rowsNumber) {
	                ii++;
	                // 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
	                str_index.push('<li><div style="display:none;">____</div></li>');
	            }
	            if (str_index.length > 2) {
	                $("#kldByLeader_list").prev().hide();
	                $("#kldByLeader_list").html(str_index.join(""));
	            }
	        });
}
function loadPsFile(param){
	if($("#psFile_list").length<1) return ;
	var url_docs = "./sysPendingsAction!getSysPendingsForCurUserOrg.shtml";

    var str_index = new Array();
    var ii = 0;
    $.getJSON(
        url_docs,
        $.param(param),
        function (data) {

            if (typeof (data.fail) != "undefined") {
                alert("取最新批示时出错：" + data.fail);
            } else {
                $("#psFile_rows").html(data.totalRows);
            }
            $.each(data.rowDatas,function () {
                    ii++;
                    if (ii <= rowsNumber) {
                        str_index.push('<li>');
                        str_index.push('	<div class="title" >');
                        str_index.push('		<a style="color:red;font-weight:bolder" href="#" onclick="openDetail(\'psFile\','+ this[0]+ ');return false;">');
                        str_index.push(this[1]);
                        str_index.push('		</a>');
                        if (this[2].substring(0, 10) == $("#today").val()) {
                            str_index.push('	<img border=0 src="'+ _skinPath+ '/images/homePage/new.gif">');
                        }
                        str_index.push('	</div>');
                        str_index.push('	<div class="date"  title="'+ this[1]+ '['+ this[2]+ ']">');
                        str_index.push('		<a href="#" onclick="openDetail(\'psFile\','+ this[0]+ ');return false;">');
                        str_index.push(this[2].substring(0, 10));
                        str_index.push('		</a>');
                        str_index.push('	</div>');
                        str_index.push('</li>');
                    }
                });

            while (ii < rowsNumber) {
                ii++;
                // 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
                str_index.push('<li><div style="display:none;">____</div></li>');
            }
            if (str_index.length > 2) {
                $("#psFile_list").prev().hide();
                $("#psFile_list").html(str_index.join(""));
            }
        });
}

/**
 * 加载最多一星期的待办数据
 * @param param
 * @returns
 */
function loadWeekTodoData(param){
	if($("#week_todo_list").length<1) return ;
//	var url_docs = "./sysPendingsAction!getSysPendingsForCurUserOrg.shtml";
	var url_docs = url_sysPending;

    var str_index = new Array();
    var ii = 0;
    $.getJSON(
        url_docs,
        $.param(param),
        function (data) {

            if (typeof (data.fail) != "undefined") {
                alert("查询待办事项时出错：" + data.fail);
            } else {
                $("#week_todo_rows").html(data.totalRows);
            }
            $.each(data.rowDatas,function () {
            		
                    ii++;
                    if (ii <= rowsNumber) {
                        str_index.push('<li>');
                        str_index.push('	<div class="title" >');
                        str_index.push('		<a href="#" onclick="openDetail(\'weekTodo\','+ this.id+ ');return false;">');
                        str_index.push(this.title);
                        str_index.push('		</a>');
                        if (this.createTime.substring(0, 10) == $("#today").val()) {
                            str_index.push('	<img border=0 src="'+ _skinPath+ '/images/homePage/new.gif">');
                        }
                        str_index.push('	</div>');
                        str_index.push('	<div class="date"  title="'+ this.title+ '['+ this.createTime+ ']">');
                        str_index.push('		<a href="#" onclick="openDetail(\'weekTodo\','+ this.id+ ');return false;">');
                        str_index.push(this.createTime.substring(0, 10));
                        str_index.push('		</a>');
                        str_index.push('	</div>');
                        str_index.push('</li>');
                    }
                });

            while (ii < rowsNumber) {
                ii++;
                // 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
                str_index.push('<li><div style="display:none;">____</div></li>');
            }
            if (str_index.length > 2) {
                $("#week_todo_list").prev().hide();
                $("#week_todo_list").html(str_index.join(""));
            }
        });
}

/**
 * 加载最多一星期的待审核数据
 * @param param
 * @returns
 */
function loadWeekCheckData(param){
	if($("#week_check_list").length<1) return ;
//	var url_docs = "./sysPendingsAction!getSysPendingsForCurUserOrg.shtml?r=" + Math.random();
	var url_docs = url_sysPending;
	
    var str_index = new Array();
    var ii = 0;
    $.getJSON(
        url_docs,
        $.param(param),
        function (data) {

            if (typeof (data.fail) != "undefined") {
                alert("查询待办审核时出错：" + data.fail);
            } else {
                $("#week_check_rows").html(data.totalRows);
            }
            $.each(data.rowDatas,function () {
            		
                    ii++;
                    if (ii <= rowsNumber) {
                        str_index.push('<li>');
                        str_index.push('	<div class="title" >');
                        str_index.push('		<a href="#" onclick="openDetail(\'weekReview\','+ this.id+ ');return false;">');
                        str_index.push(this.title);
                        str_index.push('		</a>');
                        if (this.createTime.substring(0, 10) == $("#today").val()) {
                            str_index.push('	<img border=0 src="'+ _skinPath+ '/images/homePage/new.gif">');
                        }
                        str_index.push('	<img border=0 src="'+ _skinPath+ '/images/homePage/new.gif">');
                        str_index.push('	</div>');
                        str_index.push('	<div class="date"  title="'+ this.title+ '['+ this.createTime+ ']">');
                        str_index.push('		<a href="#" onclick="openDetail(\'weekReview\','+ this.id+ ');return false;">');
                        str_index.push(this.createTime.substring(0, 10));
                        str_index.push('		</a>');
                        str_index.push('	</div>');
                        str_index.push('</li>');
                    }
                });

            while (ii < rowsNumber) {
                ii++;
                // 加"____"的原因：不加的话，首页在ie6下打开会死掉！！！！
                str_index.push('<li><div style="display:none;">____</div></li>');
            }
            if (str_index.length > 2) {
                $("#week_check_list").prev().hide();
                $("#week_check_list").html(str_index.join(""));
            }
        });
}